# Copyright 2025 Ant Group Co., Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#   http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

load("//:defs.bzl", "dataproxy_cc_library")

package(default_visibility = [
    "//test:__subpackages__",
])

dataproxy_cc_library(
    name = "dataproxy_sdk_api",
    hdrs = [
        "api.h",
    ],
    visibility = ["//visibility:public"],
    deps = [
        ":data_proxy_file",
        ":data_proxy_stream",
    ],
)

dataproxy_cc_library(
    name = "exception",
    hdrs = [
        "exception.h",
    ],
    deps = [
        "@yacl//yacl/base:exception",
    ],
)

dataproxy_cc_library(
    name = "utils",
    srcs = ["utils.cc"],
    hdrs = ["utils.h"],
    deps = [
        ":exception",
        "@arrow",
    ],
)

dataproxy_cc_library(
    name = "proto",
    srcs = ["data_proxy_pb.cc"],
    hdrs = ["data_proxy_pb.h"],
    deps = [
        ":exception",
        "@kuscia//proto/api/v1alpha1/datamesh:flightdm_cc_proto",
        # "@protobuf",
    ],
)

dataproxy_cc_library(
    name = "file_help",
    srcs = ["file_help.cc"],
    hdrs = ["file_help.h"],
    deps = [
        ":exception",
        ":proto",
        "@arrow",
    ],
)

dataproxy_cc_library(
    name = "data_proxy_conn",
    srcs = ["data_proxy_conn.cc"],
    hdrs = ["data_proxy_conn.h"],
    deps = [
        ":exception",
        "@arrow//:arrow_flight",
    ],
)

dataproxy_cc_library(
    name = "data_proxy_file",
    srcs = ["data_proxy_file.cc"],
    hdrs = ["data_proxy_file.h"],
    visibility = ["//visibility:public"],
    deps = [
        ":data_proxy_conn",
        ":exception",
        ":file_help",
        ":proto",
        ":utils",
        "@arrow//:arrow_flight",
        "@yacl//yacl/utils:scope_guard",
    ],
)

dataproxy_cc_library(
    name = "data_proxy_stream",
    srcs = ["data_proxy_stream.cc"],
    hdrs = ["data_proxy_stream.h"],
    visibility = ["//visibility:public"],
    deps = [
        ":data_proxy_conn",
        ":exception",
        ":proto",
        ":utils",
        "@arrow//:arrow_flight",
    ],
)
